package com.unitd.springboot.starter.mybatis;

import com.unitd.frame.mybatis.datasource.MutiRouteDataSource;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

/**
 * @desc 指定frame-mybatis中 数据源配置信息对象
 * @filename DataSourceConfiguration.java
 * @copyright www.unitd.com
 * @author Hudan
 * @version 1.0
 * @date 2017/12/23
 */
@Configuration
@ConditionalOnClass(MutiRouteDataSource.class)
@AutoConfigureBefore(DataSourceAutoConfiguration.class)
public class DataSourceConfiguration {

	@Bean("dataSource")
	public DataSource dataSourceBean() {
		return new MutiRouteDataSource();
	}
}